package com.elitedatai.mchtest.manage.repository;

import com.elitedatai.mchtest.manage.model.entity.DeviceDictionaryEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.Optional;

public interface DeviceDictionaryRepository extends JpaRepository<DeviceDictionaryEntity, Integer> {

    @Query(value = "SELECT * FROM manage_device_dictionary WHERE domain = :domain AND device_type = :deviceType AND sub_type = :subType LIMIT 1", nativeQuery = true)
    Optional<DeviceDictionaryEntity> findByDomainAndDeviceTypeAndSubType(
            @Param("domain") Integer domain,
            @Param("deviceType") Integer deviceType,
            @Param("subType") Integer subType);
}
